//
//  MYNewsShopDetailsGoodsCell.swift
//  MuYing
//
//  Created by tbb on 2020/3/6.
//  Copyright © 2020 TBB. All rights reserved.
//

import UIKit

class MYNewsShopDetailsGoodsCell: YQTableViewBaseCell {
    @objc var reserveActionBlock:((_ :MYNewsShopDetailsStandardModel) -> ())?
    @objc var standardModel:MYNewsShopDetailsStandardModel?{
        didSet {
            self.goodsIcon.setImageWith(URL(string:self.standardModel?.standardImage ?? ""), placeholder: nil)
            self.goodsTitleLb.text = self.standardModel?.standardName;
            self.specificationLb.text = self.standardModel?.standardDesc;
            self.priceLb.text = self.standardModel?.price;
        }
    }

    @IBOutlet weak var goodsIcon: UIImageView!
    
    @IBOutlet weak var specificationLb: UILabel!
    @IBOutlet weak var buyBtn: UIButton!
    
    @IBOutlet weak var priceLb: UILabel!
    @IBOutlet weak var goodsTitleLb: UILabel!
    override func awakeFromNib() {
        super.awakeFromNib()
        self.buyBtn.layer.cornerRadius = 16;
        self.buyBtn.layer.borderColor = UIColorFromHex(rgbValue: 0xF88282).cgColor;
        self.buyBtn.layer.borderWidth = 1;
        self.goodsIcon.layer.cornerRadius = 8;
        self.buyBtn.addTarget(self, action: #selector(reserveAction(_:)), for: .touchUpInside)
        self.buyBtn.setTitle(kYQLSSwift("预订"), for: .normal);
    }
    @objc func reserveAction(_ sender:UIButton) {
        if let reserveActionBlock = self.reserveActionBlock,let standardModel = self.standardModel  {
            reserveActionBlock(standardModel)
        }
    }
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
    }
    
}
